/**
 * Created by liuyanjun on 2017/6/27.
 */
import fetch from '../config/fetch'


/**
 * 创建临时数据 liuyj
 * @param data
 * @returns {Promise}
 */
// const setpromise = data =>{
//   return new Promise((resolve,reject)=>{
//     resolve(data);
//   })
// }
//


/**
 * 获取用户信息 liuyj
 */
export const getUser = () => fetch('GET', '', {});

/**
 * 获取手机短信验证码 liuyj
 * @param phone
 */
export const mobileCode = phone => fetch('POST', '', {
    mobile: phone,
    scene: 'login',
    type: 'sms'
});

/**
 * 检查账号是否存在 liuyj
 * @param checkNumber
 * @param type
 */
export const checkExsis = (checkNumber, type) => fetch('GET', '', {
    [type]: checkNumber,
    type
});


/**
 * 手机登录 liuyj
 * @param code 验证码
 * @param mobile 手机号
 * @param validate_token
 */
export const sendLogin = (code, mobile, validate_token) => fetch('POST', '', {
    code,mobile,validate_token
});

/**
 * 获取验证码 liuyj
 */
export const getcaptchas = () => fetch('POST', '', {});


/**
 * 账号登录 liuyj
 * @param username
 * @param password
 * @param captcha_code
 */
export const accountLogin = (username, password, captcha_code) => fetch('POST', '', {
    username,
    password,
    captcha_code
});

export const searchRestaurant = (geohash,keyword) =>fetch('',{
  'extras[]':'restaurant_activity',
  geohash,
  keyword,
  type:'search'
});








